﻿using System.Threading.Tasks;
using K9Nano.Dependency;
using K9Nano.Events;
using Microsoft.Extensions.Logging;

namespace AllInOneApiTest.Events
{
    public class EventAsyncTestDataHandler : IAsyncEventHandler<EventAsyncTestData>, IScopedDependency
    {
        private readonly ILogger _logger;

        public EventAsyncTestDataHandler(ILoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger(nameof(EventAsyncTestDataHandler));
        }

        public async Task HandleEventAsync(EventAsyncTestData eventData)
        {
            await Task.Delay(1000);
            _logger.LogInformation(eventData.Value);
        }
    }
}